package DesignPatterm.singleResponsibility;

/**
 * 单一职责原理
 */
public class SingleResponsibility1 {
    public static void main(String[] args) {
        Vehicle vehicle = new Vehicle();
        vehicle.run("自行车");

        //出现问题,飞机并不合适在路上运行,此类不符合单一职责原则
        vehicle.run("飞机");
    }
}

class Vehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在路上运行...");
    }
}
